[t:/]$ 지식_

커널 안에서 특정 코드의 수행시간 측정.

2011/11/24

linux kernel time timeval elapsed time

리눅스 안에서 특정 코드 영역의 수행 시간을 측정해야 할 때.
커널 고유 기능이나 커널 해킹 기능에 있을 것 같은데. 오프로파일 같은 것 말고요. 간단한 것.

여튼

static inline long myclock()
{
        struct timeval my_time;
        do_gettimeofday(&my_time);

        return my_time.tv_usec;

}

그리고..

        long st, et;
        printk("init!\n");

        st = myclock();

        test_func();

        et = myclock();

        printk("test end!, total_time = %ldus\n", et - st);

머 이라믄 될 듯.





공유하기













[t:/] is not "technology - root". dawnsea, rss